﻿using AppService.IService.Basic_information;
using AppService.Service.Basic_information;
using Domain.Entity.Basic_information;
using Microsoft.AspNetCore.Mvc;

namespace WebAPI.Controllers.Basic_information
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Address_mentController : ControllerBase
    {
        private readonly IAddress_mentService Iaddress_mentService;

        public Address_mentController(IAddress_mentService iaddress_mentService)
        {
            Iaddress_mentService = iaddress_mentService;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Address_ment> GetAddress_ments(int currentPage, int PageSize)
        {
            return Iaddress_mentService.GetAddress_ments(currentPage, PageSize);
        }

        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete("{id}")]
        public bool DelAddress(int id)
        {
            return Iaddress_mentService.DelAddress(id);
        }

        /// <summary>
        /// 添加地址信息
        /// </summary>
        /// <param name="address">客户类</param>
        /// <returns></returns>
        [HttpPost]
        public bool AddAddress([FromBody] Address_ment address)
        {
            return Iaddress_mentService.AddAddress(address);
        }

        /// <summary>
        /// 根据id查询客户信息
        /// </summary>
        /// <param name="id">司机id</param>
        /// <returns></returns>
        [HttpGet("{id}")]
        public Address_ment GetAddress(int id)
        {
            return Iaddress_mentService.GetAddress(id);
        }

        /// <summary>
        /// 修改客户信息
        /// </summary>
        /// <param name="address">客户类</param>
        /// <returns></returns>
        [HttpPut]
        public bool UpdAddress([FromBody] Address_ment address)
        {
            return Iaddress_mentService.UpdAddress(address);
        }

        /// <summary>
        /// 根据地址类型查询
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Address_ment> GetAr_type(int currentPage, int PageSize)
        {
            List<Address_ment> address = Iaddress_mentService.GetAr_type(currentPage, PageSize);
            return address;
        }

        /// <summary>
        /// 根据地址类型查询
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Address_ment> GetAd_type(int currentPage, int PageSize)
        {
            List<Address_ment> address = Iaddress_mentService.GetAd_type(currentPage, PageSize);
            return address;
        }


        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="value2"></param>
        /// <param name="Create_time"></param>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Address_ment> Address_condition(int currentPage, int PageSize, string? Create_time,string ? value2)
        {
            List<Address_ment> address = Iaddress_mentService.Address_condition(currentPage, PageSize, Create_time, value2);
            return address;
        }

        [HttpGet]
        public int Count(string? Create_time, string ?value2)
        {
            return Iaddress_mentService.Count(Create_time, value2);
        }
    }
}
